package com.zhiche.lisa.bms.controller.quote;


import com.baomidou.mybatisplus.plugins.Page;
import com.zhiche.lisa.bms.dao.model.quote.Quote;
import com.zhiche.lisa.bms.dao.model.quote.QuoteDtl;
import com.zhiche.lisa.bms.pojo.vo.common.CommonVO;
import com.zhiche.lisa.bms.pojo.vo.quote.QuoteAndContractVO;
import com.zhiche.lisa.bms.pojo.vo.quote.QuoteAndDtlVO;
import com.zhiche.lisa.bms.service.quote.QuoteDtlService;
import com.zhiche.lisa.bms.service.quote.QuoteService;
import com.zhiche.lisa.core.enums.CommonEnum;
import com.zhiche.lisa.core.supports.BaseException;
import com.zhiche.lisa.core.supports.RestfulResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 报价单主表 前端控制器
 * </p>
 *
 * @author liuanshun
 * @since 2018-10-22
 */
@RestController
@RequestMapping("/quote")
@Api(value = "/quote", description = "报价单接口", tags = {"报价单接口"})
public class QuoteController {
	private final Logger LOGGER = LoggerFactory.getLogger(QuoteController.class);

	@Autowired
	private QuoteService quoteService;
	@Autowired
	private QuoteDtlService quoteDtlService;

	/**
	 * 报价单分页查询接口
	 *
	 * @param page
	 * @return
	 */
	@PostMapping(value = "/getQuotePage")
	@ApiOperation(value = "根据条件查询报价信息", notes = "根据条件查询报价信息", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Page<Quote>> getQuotePage(@RequestBody Page<Quote> page) {
		LOGGER.info("QuoteController.getQuotePage Param {} ", page);
		RestfulResponse<Page<Quote>> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Page<Quote> quotePage = quoteService.selectQuotePage(page);
			restful.setData(quotePage);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.getQuotePage ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.getQuotePage ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 根据传入id查找指定报价单
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/getQuoteById/{id}")
	@ApiOperation(value = "根据id获取报价单", notes = "根据id获取报价单", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Quote> getQuoteById(@PathVariable("id") Long id) {
		LOGGER.info("QuoteController.getQuoteById Param {} ", id);
		RestfulResponse<Quote> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Quote quote = quoteService.selectById(id);
			restful.setData(quote);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.getQuoteById ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.getQuoteById ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 根据传入相关联的合同id查找指定报价单
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/getQuoteByContractId/{id}")
	@ApiOperation(value = "根据id获取报价单", notes = "根据id获取报价单", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<List<Quote>> getQuoteByContractId(@PathVariable("id") Long id) {
		LOGGER.info("QuoteController.getQuoteByContractId Param {} ", id);
		RestfulResponse<List<Quote>> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			List<Quote> quotes = quoteService.selectQuoteListByContractId(id);
			restful.setData(quotes);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.getQuoteByContractId ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.getQuoteByContractId ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 根据传入报价单id号查找指定报价单详明
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/getQuoteDtlById/{id}")
	@ApiOperation(value = "根据id获取报价单详明", notes = "根据id获取报价单详明", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = QuoteDtl.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<List<QuoteDtl>> getQuoteDtlById(@PathVariable("id") Long id) {
		LOGGER.info("QuoteController.getQuoteDtlById Param {} ", id);
		RestfulResponse<List<QuoteDtl>> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			List<QuoteDtl> quote = quoteDtlService.selectQuoteDtlsByHeaderId(id);
			restful.setData(quote);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.getQuoteDtlById ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.getQuoteDtlById ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 根据传入报价单id号查找指定报价单及报价单详明信息
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/getQuoteAndDtlById/{id}")
	@ApiOperation(value = "根据id获取报价单", notes = "根据id获取报价单", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = QuoteAndDtlVO.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<QuoteAndDtlVO> getQuoteAndDtlById(@PathVariable("id") Long id) {
		LOGGER.info("QuoteController.getQuoteAndDtlById Param {} ", id);
		RestfulResponse<QuoteAndDtlVO> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			QuoteAndDtlVO quote = quoteService.selectQuoteAndDtl(id);
			restful.setData(quote);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.getQuoteAndDtlById ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.getQuoteAndDtlById ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 根据传入的报价单信息进行新增
	 *
	 * @param quote
	 * @return
	 */
	@PostMapping(value = "/addQuote")
	@ApiOperation(value = "新增报价单", notes = "新增报价单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Quote> addQuote(@RequestBody Quote quote) {
		LOGGER.info("QuoteController.addQuote Param {} ", quote);
		RestfulResponse<Quote> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Quote outQuote = quoteService.insertOneQuote(quote);
			restful.setData(outQuote);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.addQuote ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.addQuote ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 根据传入的报价单及详明信息进行新增
	 *
	 * @param quote
	 * @return
	 */
	@PostMapping(value = "/addQuoteAndDtl")
	@ApiOperation(value = "新增报价单", notes = "新增报价单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Quote> addQuoteAndDtl(@RequestBody QuoteAndDtlVO quote) {
		LOGGER.info("QuoteController.addQuoteAndDtl Param {} ", quote);
		RestfulResponse<Quote> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Quote outQuote = quoteService.insertQuoteAndDtl(quote);
			restful.setData(outQuote);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.addQuoteAndDtl ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.addQuoteAndDtl ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 根据包含id的报价单根据传入的剩余数据
	 *
	 * @param quote
	 * @return
	 */
	@PostMapping(value = "/updateQuote")
	@ApiOperation(value = "修改报价单", notes = "修改报价单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Quote> updateQuote(@RequestBody Quote quote) {
		LOGGER.info("QuoteController.updateQuote Param {} ", quote);
		RestfulResponse<Quote> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Quote outQuote = quoteService.updateOneQuote(quote);
			restful.setData(outQuote);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.updateQuote ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.updateQuote ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 根据包含报价单id的报价单和详明信息进行匹配修改
	 *
	 * @param quote
	 * @return
	 */
	@PostMapping(value = "/updateQuoteAndDtl")
	@ApiOperation(value = "修改报价单及详明", notes = "修改报价单及详明", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Quote> updateQuoteAndDtl(@RequestBody QuoteAndDtlVO quote) {
		LOGGER.info("QuoteController.updateQuoteAndDtl Param {} ", quote);
		RestfulResponse<Quote> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Quote outQuote = quoteService.updateQuoteAndDtl(quote);
			restful.setData(outQuote);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.updateQuoteAndDtl ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.updateQuoteAndDtl ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}


	/**
	 * 根据包含报价单id和合同附属信息的数据进行临时合同的生成
	 *
	 * @param quoteAndContractVO
	 * @return
	 */
	@PostMapping(value = "/createTemporaryContract")
	@ApiOperation(value = "创建临时合同", notes = "创建临时合同", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success"), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<String> createTemporaryContract(@RequestBody QuoteAndContractVO quoteAndContractVO
			, @RequestHeader("Authorization") String token) {
		LOGGER.info("QuoteController.createTemporaryContract Param {} ", quoteAndContractVO);
		RestfulResponse<String> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			quoteService.createTemporaryContract(quoteAndContractVO, token);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.createTemporaryContract ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.createTemporaryContract ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 修改指定id号审核状态
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/submitExamine/{id}")
	@ApiOperation(value = "提交报价单的审核请求", notes = "提交报价单的审核请求", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Quote> submitExamine(@PathVariable Long id) {
		LOGGER.info("QuoteController.submitExamine Param {} ", id);
		RestfulResponse<Quote> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Quote outQuote = quoteService.submitExamine(id);
			restful.setData(outQuote);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.submitExamine ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.submitExamine ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 批量修改指定id号信息的报价单审核状态
	 *
	 * @param commonVO 包含{ids}参数的id数据组结构
	 * @return
	 */
	@PostMapping(value = "/submitExamine")
	@ApiOperation(value = "提交报价单的审核请求", notes = "提交报价单的审核请求", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success"), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<List<String>> submitExamines(@RequestBody CommonVO<Quote> commonVO) {
		LOGGER.info("QuoteController.submitExamines Param {} ", commonVO);
		RestfulResponse<List<String>> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			List<String> msg = new ArrayList<>();
			for (Long id :
					commonVO.getIds()) {
				try {
					quoteService.submitExamine(id);
					msg.add("审核请求::成功");
				} catch (BaseException e) {
					msg.add("审核请求::" + e.getMessage());
					restful.setCode(-2);
				} catch (Exception e) {
					msg.add("审核请求::审核失败");
					restful.setCode(-2);
				}
			}
			restful.setData(msg);
		} catch (BaseException e) {
			LOGGER.error("QuoteController.submitExamines ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("QuoteController.submitExamines ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}


	/**
	 * 修改指定id号状态为弃审
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/blankOut/{id}")
	@ApiOperation(value = "作废指定报价单", notes = "作废指定报价单", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Quote> blankOut(@PathVariable("id") Long id) {
		LOGGER.info("/QuoteController.blankOut Param {} ", id);
		RestfulResponse<Quote> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Quote outQuote = quoteService.blankOut(id);
			restful.setData(outQuote);
		} catch (BaseException e) {
			LOGGER.error("/QuoteController.blankOut ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("/QuoteController.blankOut ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 批量修改指定id号信息的报价单状态为弃审
	 *
	 * @param commonVO 包含{ids}参数的id数据组结构
	 * @return
	 */
	@PostMapping(value = "/blankOut")
	@ApiOperation(value = "作废指定报价单", notes = "作废指定报价单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success"), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<List<String>> blankOuts(@RequestBody CommonVO<Quote> commonVO) {
		LOGGER.info("/QuoteController.blankOuts Param {} ", commonVO);
		RestfulResponse<List<String>> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			List<String> msg = new ArrayList<>();
			for (Long id :
					commonVO.getIds()) {
				try {
					quoteService.blankOut(id);
					msg.add("作废请求::成功");
				} catch (BaseException e) {
					msg.add("作废请求::" + e.getMessage());
					restful.setCode(-2);
				} catch (Exception e) {
					msg.add("作废请求::作废失败");
					restful.setCode(-2);
				}
			}
			restful.setData(msg);
		} catch (BaseException e) {
			LOGGER.error("/QuoteController.blankOuts ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("/QuoteController.blankOuts ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 修改指定id号状态为审核
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/examine/{id}")
	@ApiOperation(value = "审核指定报价单", notes = "审核指定报价单", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success", response = Quote.class), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<Quote> examine(@PathVariable("id") Long id) {
		LOGGER.info("/QuoteController.examine Param {} ", id);
		RestfulResponse<Quote> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			Quote outQuote = quoteService.examine(id);
			restful.setData(outQuote);
		} catch (BaseException e) {
			LOGGER.error("/QuoteController.examine ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("/QuoteController.examine ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}

	/**
	 * 修改指定id号状态为审核
	 *
	 * @param commonVO
	 * @return
	 */
	@PostMapping(value = "/examine")
	@ApiOperation(value = "审核指定报价单", notes = "审核指定报价单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
	@ApiResponses({@ApiResponse(code = 0, message = "success"), @ApiResponse(code = -1, message = "系统异常")})
	public RestfulResponse<List<String>> examines(@RequestBody CommonVO<Quote> commonVO) {
		LOGGER.info("/QuoteController.examines Param {} ", commonVO);
		RestfulResponse<List<String>> restful = new RestfulResponse<>(CommonEnum.SUCCESS.getCode(), CommonEnum.SUCCESS.getText(), null);
		try {
			List<String> msg = new ArrayList<>();
			for (Long id :
					commonVO.getIds()) {
				try {
					quoteService.examine(id);
					msg.add("审核::成功");
				} catch (BaseException e) {
					msg.add("审核::" + e.getMessage());
					restful.setCode(-2);
				} catch (Exception e) {
					msg.add("审核::审核失败");
					restful.setCode(-2);
				}
			}
			restful.setData(msg);
		} catch (BaseException e) {
			LOGGER.error("/QuoteController.examines ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), e.getMessage(), null);
		} catch (Exception e) {
			LOGGER.error("/QuoteController.examines ERROR: {}", e.getMessage());
			restful = new RestfulResponse(CommonEnum.ERROR.getCode(), CommonEnum.ERROR.getText(), null);
		}
		return restful;
	}
}

